@import '@bifrostui/styles/mixins/index.less';

@{root-selector} {
  --bui-swipe-action-container-padding: 10px;
  --bui-swipe-action-container-color: var(--bui-color-black);
}

.bui-swipe-action {
  background: var(--bui-color-bg-view);
  font-family: var(--bui-font-family);
  overflow: hidden;
  touch-action: pan-x;

  &-track {
    position: relative;
    transition: transform 200ms ease;
  }

  &-actions {
    position: absolute;
    top: 0;
    display: flex;
    width: auto;
    white-space: nowrap;

    &-right {
      left: 100%;
      height: 100%;
      cursor: pointer;
      margin-left: 1px;
      // 禁止选中
      user-select: none;
      display: flex;
      align-items: center;
      box-sizing: content-box;
    }

    &-left {
      margin-right: 1px;
      right: 100%;
      height: 100%;
      cursor: pointer;
      box-sizing: content-box;
      // 禁止选中
      user-select: none;
      display: flex;
      align-items: center;
    }
  }

  &-button {
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: #fff;
    box-sizing: content-box;
    white-space: nowrap;
  }

  &-content-container {
    overflow: hidden; // 避免内容溢出
    position: relative;
    cursor: grab;
    // 禁止选中
    user-select: none;
    padding: var(--bui-swipe-action-container-padding);
    color: var(--bui-swipe-action-container-color);

    &:active {
      cursor: grabbing;
    }
  }

  &-content-mask {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  &-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    height: 100%;
  }
}
